home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.6 KB | 53 lines | [TEXT/GEOL] |
- Item 8362597 17-Jan-91 11:57PST
-
- From: KNEPPER Knepper, Christopher
-
- To: POWERUP.ENG Power Up Software,PRT
-
- cc: MACAPP.TECH$ MacApp Technical
-
- ------------------------------------------------------------------------------
-
- Sub: Re: Contest
-
- James,
-
- I'd like to help out those who prepare entries for your contest.
-
- >The contest is to write a subclass of TPicture, TAspectPicture, that draws
- >its picture with its original proportions (neither squashed nor stretched),
- >centered in the TPicture's rectangle. In every other respect the control
- >should be drawn (and otherwise behave) just as does a TPicture.
- >
- >The thing that makes this difficult is Object Pascal's lack of a scope
- >resolution feature. Ideally, one would simply override TPicture.Draw()
- >replacing it with the desired functionality, and then call TControl's Draw(),
- >which handles adornment, hiliting, and dimming. But, to my knowledge, you
- >can't do that in Object Pascal.
-
- Here's a clue as to how to call INHERITED Draw from within TAspectPicture.Draw
- and not get the functionality of TPicture.Draw, but instead to get the
- functionality needed in TControl.Draw:
-
- PROCEDURE TAspectPicture.Draw(area: Rect); OVERRIDE;
-
- VAR
- saveDataHandle: PicHandle;
-
- BEGIN
- { 1st. draw the picture "correctly" }
- …fill in this blank…
-
- { 2nd. (the hard part!) call INHERITED Draw without having TPicture.Draw do
- anything }
- saveDataHandle := fDataHandle;
- fDataHandle := NIL;
- INHERITED Draw(area);
- fDataHandle := saveDataHandle;
- END;
-
- May the best man/woman win!
-
- -Chris
-
-